Ok, finally did it! I changed the textout's with images, and then inserted some sleeptime's and voilá!
My final, working code:
Hope this helps someone. Thank you to all of you guys! You helped me a lot, without you, I'd never finish this. So, thank you.Code:#include <stdio.h> #include <allegro.h> int main(void) { BITMAP *bmp; PALETTE palette; allegro_init(); set_color_depth(24); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0); install_keyboard(); int sleepTime; bmp = load_bitmap("1.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=20; sleep(sleepTime); clear_bitmap(bmp); bmp = load_bitmap("2.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=40; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("Super.bmp", palette); draw_sprite(screen, bmp, 1, 1); sleepTime=3; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("PDA.bmp", palette); draw_sprite(screen, bmp, 1, 400); sleepTime=2; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("3.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=5; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("consti.bmp",palette); draw_sprite(screen, bmp, 1, 1); sleepTime=15; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("4.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=22; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("SO.bmp", palette); draw_sprite(screen, bmp, 0, 0); sleepTime=10; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("5.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=12; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("6.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=35; sleep(sleepTime); clear_bitmap(bmp); bmp = load_bitmap("Ubuntu.bmp",palette); draw_sprite(screen, bmp, 1, 1); sleepTime=5; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("XP.bmp", palette); draw_sprite(screen, bmp, 1, 40); sleepTime=5; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("7even.bmp", palette); draw_sprite(screen, bmp, 1, 80); sleepTime=5; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("7.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=35; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("command.bmp", palette); draw_sprite(screen, bmp, 8, 8); sleepTime=3; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("8.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=22; sleep(sleepTime); void destroy_bitmap(bmp); bmp = load_bitmap("9.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=10; sleep(sleepTime); void destroy_bitmap(bmp); readkey(); return 0; } END_OF_MAIN()
The program now opens a Window, displaying the text (in an image), and display the others, with intervals between each other... Just like a Presentation. In the end, it exits automatically. Just like I wanted.
Again, THANK YOU.
Regards,
JPCanaverde
Last edited by jpcanaverde; 06-05-2010 at 09:23 AM.
Ok, noticed now that when the program gets to this part:
It crashes and exits. It displays the 6.bmp and does the sleeptime properly... But then it exits. I think it is the memory that is full, so it exits. It doesn't clear the bitmaps! I already tried with various and different commands, but it just don't works! The bitmaps aren't deleted!Code:(...) bmp = load_bitmap("6.bmp", palette); draw_sprite(screen, bmp, 0, 255); sleepTime=35; sleep(sleepTime); clear_bitmap(bmp); bmp = load_bitmap("Ubuntu.bmp",palette); draw_sprite(screen, bmp, 1, 1); (...)
Can you help me, please? When I thought I finished...
I thinked it worked before because all was running well... So I got busy, and the program had finished. So I thought it was OK, because when it goes to end, it exits. (I had something in the end to close it.)
When I ran the program the second time, I noticed it.
I asked for help in the Allegro forums too.
[Help] Destroy bitmaps
Now this is more Allegro-based... Hope someone can help me there.
Ok, so now the program works. It was a little-little thing: The filename was named ubuntu.bmp, and in the code I had Ubuntu.bmp.
So... The program works. That's a fact. But it just works on my computer, with Ubuntu. I tried on two different computers (one with Ubuntu, another with Windows) and it doesn't work. I really don't want to take my laptop to school...
Presuming you mean it compiles but then seg faults -- stuff like that happens pretty easily. The problem is that when a compiler puts something together, it may put it together in such a way that some small memory overwrite/out of bounds mistake is harmless, so you won't notice it. Then it gets put together by another compiler slightly differently, and the mistake causes a seg fault.
I've made mistakes I did not notice until the code was compiled on a third and even fourth different system.
So you have to find the mistake and correct it. It's still certainly a mistake.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
In Windows Code::Blocks, it says something about mangled_main and winmain... I post the full error later.